//package com.vincce.sport.core.base;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import com.vincce.translationPM.core.utils.Constant;
//import com.vincce.translationPM.entity.Project;
//import com.vincce.translationPM.entity.Ship;
//import com.vincce.translationPM.entity.Task;
//import com.vincce.translationPM.entity.User;
//import com.vincce.translationPM.mapper.ProjectMapper;
//import com.vincce.translationPM.mapper.ShipMapper;
//import com.vincce.translationPM.mapper.TaskMapper;
//
//import org.apache.shiro.SecurityUtils;
//
///**
// * Created with IntelliJ IDEA.
// * User: xupeng
// * Date: 13-12-1
// * Time: 下午8:21
// * To change this template use File | Settings | File Templates.
// */
//public class BaseControllerSupport {
//    public static String SUCCESS = "success";
//
//    public static String FAIL = "fail";
//    
//    @javax.annotation.Resource
//    private ProjectMapper projectMapper;
//    
//    @javax.annotation.Resource
//    private ShipMapper shipMapper;
//    
//    @javax.annotation.Resource
//    private TaskMapper taskMapper;
//
//    /**
//     * 获取当前登录用户
//     * @return
//     */
//    public User getCurrentUser () {
//        return (User)SecurityUtils.getSubject().getPrincipal();
//    }
//    
//    /**
//     * project树形条
//     */
//    public List<Project> projectTree(Integer roleId){
//    	List<Project> projectList = null;
//    	if(roleId == Constant.ROLE_STAFF){		//普通员工
//    		Map<String, Object> map = new HashMap<String, Object>();
//    		map.put("taskUser", this.getCurrentUser().getId());
//    		map.put("orderTitle", "1");
//    		projectList = projectMapper.findProjectList(map);
//    		if(projectList != null && projectList.size() > 0){
//        		for(Project project2 : projectList){
//        			map.put("projectId", project2.getId());
//            		List<Ship> shipList = shipMapper.findShipList(map);
//            		project2.setShipList(shipList);
//            		if(shipList != null && shipList.size() > 0){
//            			for(Ship ship : shipList){
//            				map.put("shipId", ship.getId());
//            				List<Task> taskList = taskMapper.findTaskList(map);
//            				ship.setTaskList(taskList);
//            			}
//            		}
//            	}
//        	}
//    	}else{
//    		projectList = projectMapper.findAllProject();
//    		if(projectList != null && projectList.size() > 0){
//        		for(Project project2 : projectList){
//            		List<Ship> shipList = shipMapper.findShipByProjectId(project2.getId());
//            		project2.setShipList(shipList);
//            		if(shipList != null && shipList.size() > 0){
//            			for(Ship ship : shipList){
//            				List<Task> taskList = taskMapper.findTaskByShipId(ship.getId());
//            				ship.setTaskList(taskList);
//            			}
//            		}
//            	}
//        	}
//    	}
//    	return projectList;
//    }
//}
